package com.easy.west.westclient.api.user.api;

import android.content.Context;
import android.support.annotation.NonNull;

import com.easy.west.westclient.api.base.callback.BaseCallBack;
import com.easy.west.westclient.api.base.impl.BaseImpl;
import com.easy.west.westclient.api.login.bean.User;
import com.easy.west.westclient.api.user.bean.UserList;
import com.easy.west.westclient.api.user.event.CancelFollowEvent;
import com.easy.west.westclient.api.user.event.FollowEvent;
import com.easy.west.westclient.api.user.event.GetFollowListEvent;
import com.easy.west.westclient.api.user.event.GetMyFollowersEvent;
import com.easy.west.westclient.api.user.event.IsFollowEvent;
import com.easy.west.westclient.util.UUIDGenerator;

public class UserImpl extends BaseImpl<UserService> implements UserApi
{

    public UserImpl(@NonNull Context context) {
        super(context);
    }

    @Override
    public String followuser(String accesstoken, long onwerId, long targetId) {
        String uuid = UUIDGenerator.getUUID();
        service.follow(accesstoken,onwerId,targetId).enqueue(new BaseCallBack<String>(new FollowEvent(uuid)));
        return uuid;
    }

    @Override
    public String getMyfollowerList(int num, long ownerId) {
        String uuid = UUIDGenerator.getUUID();
        service.getMyfollowerList(num,ownerId).enqueue(new BaseCallBack<UserList>(new GetMyFollowersEvent(uuid)));
        return uuid;
    }

    @Override
    public String isfollow(String accesstoken, long targetId) {
        String uuid = UUIDGenerator.getUUID();
        service.isfollow(accesstoken,targetId).enqueue(new BaseCallBack<Boolean>(new IsFollowEvent(uuid)));
        return uuid;
    }

    @Override
    public String getMyfollowList(int num, String access_token) {
        String uuid = UUIDGenerator.getUUID();
        service.getMyfollowlist(num,access_token).enqueue(new BaseCallBack<>(new GetFollowListEvent(uuid)));
        return uuid;
    }

    @Override
    public String cancelfollow(long target_id, String access_token) {
        String uuid = UUIDGenerator.getUUID();
        service.cancelFollow(target_id,access_token).enqueue(new BaseCallBack<String>(new CancelFollowEvent(uuid)));
        return uuid;
    }
}
